/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.google.code.p.narcissus.ui.components.toolbar;

import java.awt.Insets;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;

/**
 *<p>
 *  Initial code for this button directly comes from this source: http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JToolBar.html <br />
 *  Modified to have ToggleButtons usable in toolbars.
 * </p>
 * @author jadoj
 */
public class ToolbarButton extends JButton {
  private static final Insets margins =
    new Insets(0, 0, 0, 0);

  public ToolbarButton(Icon icon) {
    super(icon);
    setMargin(margins);
    setVerticalTextPosition(BOTTOM);
    setHorizontalTextPosition(CENTER);
  }

  public ToolbarButton(String imageFile) {
    this(new ImageIcon(imageFile));
  }

  public ToolbarButton(String imageFile, String text) {
    this(new ImageIcon(imageFile));
    setText(text);
  }

  public ToolbarButton(){
      super();
  }

}